<?php 
//print_r($HttpResult);
if(1==2){$HttpResult = new HttpResult();}
	
	  $HttpContentResult = $HttpResult->getHttpContentResult();
//	  Debug::print_r($HttpResult);
//	  $lang = Config::DEFAULT_LOCALE;
		$head = new HtmlHeader($HttpContentResult->getHeader());
		$head->addCSS('reset');
		$head->addCSS('print','', 'print', 'meusdados');
		$head->addCSS('ie',  'css/ie', 'print',true);
		
		$head->addCSS('forum',"css/admin");		
		
		//<!-- PROGRAMACAO JS | JQUERY  -->
		$head->addJS(array('jquery', 'masked'));
		
	    //MENU DROPDOWN
	    $head->addJS('Menu principal','js/menu/ddsmoothmenu');
	    $head->addCSS('Menu CSS','js/menu/ddsmoothmenu');
	    
	    //TINYMCE
	    $head->addJS('tinymce','js/tinymce/jquery.tinymce');
	  	
		//<!-- JQUERY UI  -->
		$head->addJS('UI', 'js/UI/js/jquery-ui-1.8.6.custom.min');
		$head->addCSS('UI','js/UI/css/smoothness/jquery-ui-1.8.6.custom');

		//<!-- VTIP  -->
		$head->addJS('vtip', 'js/vtip/vtip');
		$head->addCSS('vtip', 'js/vtip/vtip');
		
		//<!-- TABLE SORTER -->
		$head->addJS('tablesorter', 'js/tablesorter/tablesorter');
		$head->addCSS('tablesorter', 'js/tablesorter/tablesorter');
		
		
    
    //<!-- PROGRAMACAO JS | JQUERY  -->
    $head->addJS(array('utils/validation', 'admin/partner_admin/update', 'admin_select','admin', 'admin/partner_admin/list'));
    
	$header_html = $head->show(TRUE);
$header_html = str_replace(array("democrart", "democrArt", "Democrart", "DemocrArt"), array("expressaoartistica", "Expressão Artística", "Expressão Artística", "Expressão Artística"), $header_html);
echo $header_html;
	$PartnerVO = $HttpContentResult->return_result_vo->result;
	if(FALSE){
		$PartnerVO = new PartnerVO();
	}
?>
 
<body>

<div id="main">
     <?php include Config::getFolderView("parts/admin/header.php"); ?>
      
	  <div id="main_content">
	  
	  <div id="msgBox">
			<?php 
			
					//se for setado o return_result_vo ele pega a array de messages e exibe, independende se Ã© erro ou sucesso
					if(isset($HttpContentResult->return_result_vo) && count($HttpContentResult->return_result_vo->array_messages) > 0){
				    	foreach($HttpContentResult->return_result_vo->array_messages as $system_message){
			//	    		$system_message = $formData->translateMessage($system_message);
							?>
							<p class="success"><?php echo $system_message; ?></p>
							<?php
				    	}
				    }
			?>	  
	  </div>
	  			
		 <div id="box_right">
			<h1>Atualizar Parceiro</h1>
			
			<div style="clear:both">
			<form name="frmCadastro" id="frmCadastro" class="frm" method="post" action="<?php echo Config::getRootPath("admin/partner_admin/update/id.".$PartnerVO->id); ?>">
			
				<ul>
					<li class="separador">DADOS DO PARCEIRO</li>
					<li>
						<label>Tipo de Parceiro:</label>
						<label class="info" ><input type="radio" name="user_type_id" value="2" id="user_type_id" <?php echo ($PartnerVO->user_type_id == "2")?'checked="checked"':''; ?> class="rad" />Afiliado</label>
						<label class="info" ><input type="radio" name="user_type_id" value="3" id="user_type_id" <?php echo ($PartnerVO->user_type_id == "3")?'checked="checked"':''; ?> class="rad" />Arquiteto / Decorador</label>
					</li>
					
					<li>
						<label>Ativo:</label>
						<label class="info" ><input type="radio" name="afiliate_active" value="1" id="afiliate_active" <?php echo ($PartnerVO->getActive() == "1")?'checked="checked"':''; ?> class="rad" />sim</label>
						<label class="info" ><input type="radio" name="afiliate_active" value="0" id="afiliate_active" <?php echo ($PartnerVO->getActive() == "0")?'checked="checked"':''; ?> class="rad" />Moderar</label>
						<label class="info"><input type="radio" name="afiliate_active" value="-1" id="afiliate_active" <?php echo ($PartnerVO->getActive() == "-1")?'checked="checked"':''; ?> class="rad" />não</label>
					</li>

					<li>
						<label>Profissão:</label>
						<input type="text" size="40" name="profession" id="profession" class="req" value="<?php echo $PartnerVO->profession; ?>"/><label class="info">*</label>
					</li>
					
					<li>
						<label for="nome">Nome:</label>
						<input type="text" size="40" name="name" id="nome" value="<?php echo $PartnerVO->name; ?>"/><label class="info">*</label>
					</li>

					<li>
						<label for="telefone">Telefone para contato:</label>
						<input type="text" size="25" name="phone" id="telefone" class="req" value="<?php echo $PartnerVO->phone; ?>" /><label class="info">*</label>
					</li>
															
					<li>
						<label for="nascimento">Data de nascimento:</label>
						<input type="text" size="20" name="birthday" id="nascimento"  value="<?php echo DataHandler::convertDateToBrazil($PartnerVO->birthday, TRUE); ?>"/><label class="info">* Formato DD/MM/AAAA. </label>
					</li>
					
					<li>
						<label>Sexo:</label>
						<label class="info" ><input type="radio" name="sex" value="0" id="masc" <?php echo ($PartnerVO->sex == 0)?'checked="checked"':''; ?> class="rad" />Masculino</label>
						<label class="info"><input type="radio" name="sex" value="1" id="fem" <?php echo ($PartnerVO->sex == 1)?'checked="checked"':''; ?> class="rad" />Feminino</label>
					</li>
					
					<li>
						<label for="cep">CPF / CNPJ:</label>
						<input type="text" size="40" name="cpf" id="cpf" class="req" value="<?php echo $PartnerVO->getCpf(); ?>" /><label class="info">*</label>
					</li>
					
					<li>
						<label for="empresa">Empresa:</label>
						<input type="text" size="40" name="company" id="empresa" value="<?php echo $PartnerVO->company; ?>"/>
					</li>
					
					<li>
						<label for="website">Website:</label>
						<input type="text" size="40" name="site_url" id="website" value="<?php echo $PartnerVO->site_url; ?>"/>
					</li>
					<li>
						<label for="paypal">Paypal:</label>
						<input type="text" size="40" name="paypal" id="paypal" value="<?php echo $PartnerVO->paypal; ?>"/>
					</li>
					<li>
						<label for="banco">Banco:</label>
						<input type="text" size="40" name="bank" id="bank" value="<?php echo $PartnerVO->bank; ?>"/>
					</li>
					<li>
						<label for="banco_count">Conta do Banco:</label>
						<input type="text" size="40" name="account" id="account" value="<?php echo $PartnerVO->account; ?>"/>
					</li>
					<li>
						<label for="website">Conta do Banco:</label>
						<input type="text" size="40" name="account" id="account" value="<?php echo $PartnerVO->account; ?>"/>
					</li>
					
					<li class="separador">DADOS PARA ACESSO</li>
					
					<li>
						<label for="email">E-mail:</label>
						<input type="text" size="40" name="email" id="email" value="<?php echo $PartnerVO->email; ?>"/><label class="info">*</label>
					</li>
					
						<li>
						<label for="senha">Senha:</label>
						<input type="password" size="20" name="password" id="password" value="<?php echo $PartnerVO->password; ?>"/><label class="info">*</label>
					</li>
					
					<li>
						<label for="confirmSenha">Confirme a senha:</label>
						<input type="password" size="20" name="confirm_password" id="confirm_password"  value="<?php echo ($_POST)?DataHandler::getValueByArrayIndex($_POST, "confirm_password"):$PartnerVO->password; ?>"/><label class="info">*</label>
					</li>
				
					<li>
						<label>Deseja receber informações do site?</label>
						<label class="info"><input type="radio" name="recive_news" value="1" id="sim" <?php echo ($PartnerVO->sex == 1)?'checked="checked"':''; ?> checked="checked" class="rad" />Sim</label>
						<label class="info"><input  type="radio" name="recive_news" value="0" id="nao" <?php echo ($PartnerVO->sex == 0)?'checked="checked"':''; ?> class="rad" />Não</label>
					</li>
					
					<li>
						<input type="hidden" value="Endereço Padrão" name="alias" /> 
						<input type="submit" value="Enviar" id="enviar" class="btEnviar" />
					</li>

					<li class="separador">ENDEREÇOS</li>
				</ul>
				<table class="tablesorter">
						<thead>
							<tr>
								<th>Rua</th>
								<th>CEP</th>
								<th>Cidade</th>
								<th>País</th>
								<th>End. Principal?</th>
								<th>Editar</th>
								<th>Excluir</th>
							</tr>
						</thead>
						<tbody>
						<?php if(isset($PartnerVO->array_address)){?>
							<?php foreach($PartnerVO->array_address as $address){ ?>
								<tr id="address_<?php echo $address->id ?>">
									<td><?php echo $address->street; ?></td>
									<td><?php echo $address->zip_code; ?></td>
									<td><?php echo $address->city; ?></td>
									<td><?php echo $address->country; ?></td>
									<td><?php echo ($PartnerVO->address_id != $address->id)?"não":"sim";?></td>
									<td class="ico">
										<a  href="<?php echo Config::getRootPath("admin/partner_admin/update_address/user_id.".$PartnerVO->id."/address_id.".$address->id) ?>">
										<img id="edit1" src="<?php echo Config::getAsset("assets/img/icons/edit.jpg");?>" alt="Editar" title="" />
										</a>
									</td>
									<td class="ico">
									<?php if($PartnerVO->address_id != $address->id){?>
										<a class="del" name="address" id="<?php echo $address->id ?>" href="<?php echo Config::getRootPath("admin/partner_admin/delete_address/user_id.".$PartnerVO->id."/address_id.".$address->id) ?>">
										<img id="del1" src="<?php echo Config::getAsset("assets/img/icons/delete.jpg");?>" alt="Excluir" title="" />
										</a>
									<?php }?>
									</td>
								</tr>
							<?php } ?>	
						<?php }?>	
						</tbody>
					</table>
			</form>
			<a style="float: right;margin: 10px 5px;" href="<?php echo Config::getRootPath("admin/partner_admin/insert_address/user_id.".$PartnerVO->id) ?>" class="button">Novo Endereço</a>
			</div>
				</div>

			</div>
		<li class="separador"></li>
		</div>
			<!-- FIM DO QUADRO -->
	
	</div>
	
</div>
</body>
</html>
